package com.leyou.service.impl;

import com.leyou.domain.SysUser;
import com.leyou.mapper.UserMapper;
import com.leyou.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
//        try {
            SysUser sysUser = userMapper.findByName(s);
            return sysUser;
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new UsernameNotFoundException("账号或密码错误");
//        }
    }

}
